package org.easymis.air.southwest.modules.organize.service.impl;

import java.util.HashMap;
import java.util.List;

import org.easymis.air.southwest.modules.organize.service.MemberMng;
import org.easymis.entitys.mybatis.dto.Member;
import org.easymis.entitys.mybatis.dto.Organize;
import org.easymis.entitys.mybatis.dto.OrganizeFunction;
import org.easymis.entitys.mybatis.mapper.MemberMapper;
import org.easymis.entitys.mybatis.mapper.OrganizeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MemberMngImpl implements MemberMng {
	@Autowired
	private MemberMapper mapper;

	@Autowired
	private OrganizeMapper orgMapper;
	
	public List<org.easymis.entitys.mybatis.dto.Member> getList(Member bean) {
		return null;//return this.mapper.getList(params);
	}
	
	public Member findByMemberIdOrgId(HashMap<String, Object> params){
		return mapper.findByMemberIdOrgId(params);
	}

	public void save(org.easymis.entitys.mybatis.dto.Member bean) {
		this.mapper.save(bean);
	}

	public void update(org.easymis.entitys.mybatis.dto.Member bean) {
		this.mapper.update(bean);
	}

	public void delete(String memberId) {
		this.mapper.delete(memberId);
	}

	public org.easymis.entitys.mybatis.dto.Member findById(String memberId) {
		return this.mapper.findById(memberId);
	}
	public Member findByMobile(String mobile) {
		return mapper.findByMobile(mobile);
	}
	/**
	 * 通过用户名[手机号]查询该用户的所有Member信息
	 */
	public Member findByMobileLogin(String memberName) {
		return this.mapper.findByMobileLogin(memberName);
	}
	
	/**
	 * 通过用户所选择的要进入哪个公司系统，获取某公司的权限菜单[后期要是做按钮级别的权限控制时，可能会需要小改动]
	 * @param params
	 * @return
	 */
	public List<OrganizeFunction> getListOnStaff(HashMap<String, Object> params) {
		return this.mapper.getListOnStaff(params);
	}

	/**
	 * 通过用户的Id获取该用户到底有多少个组织，组织大于1就登录的时候让用户选择进入哪个组织
	 */
	public List<Organize> findByMembernameOnOrganize(String memberId) {
		HashMap<String, Object> params = new HashMap<String, Object>();
		params.put("workStatus", 1);
		params.put("status", 1);
		params.put("memberId", memberId);
		return orgMapper.getOrgListByMemberId(params);
	}
}
